package com.fp.m7.model;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.MappedSuperclass;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import com.fp.m7.api.model.AbstractEntity;

@MappedSuperclass
public abstract class EntityBase extends AbstractEntity {
	private static final long serialVersionUID = 4196819614813577474L;

	protected Date auditCD;

	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
	@Override
	public Long getId() {
		return id;
	}
	
	@Override
	public void setId(Serializable id) {
		this.id = (Long) id;
	}

	@Temporal(TemporalType.TIMESTAMP)
	@Column(nullable = false)
	public Date getAuditCD() {
		return auditCD;
	}

	public void setAuditCD(Date auditCD) {
		this.auditCD = auditCD;
	}

	@Override
	public String toString() {
		return new StringBuilder("EntityBase [id=").append(id)//
				.append("; auditCD=").append(auditCD).append("]").toString();
	}
}
